<?php
if (get_get("op") == "register") {
    $passwd = get_post("passwd");
    if (strlen($passwd) < 6) {
        die(returnMessage(-1,"密码长度应当大于6位"));
    }
    $phone = get_post("phonenumber");
    if (! ($phone == "" || isPhoneNumber($phone))) {
        die(returnMessage(-2,"手机号格式不合法"));
    }
    $email = get_post("email");
    if (! ($email == "" || isEmail($email))) {
        die(returnMessage(-3,"电子邮件格式格式不合法"));
    }
    if ($email == "" && $phone == "") {
        die(returnMessage(-4,"手机号或电子邮件必选一个"));
    }
    $backcode = register_login_info($passwd, $email, $phone);
    if ($backcode == 1) {
        die(returnMessage(1,"邮箱已经被注册过了"));
    }
    if ($backcode == 2) {
        die(returnMessage(2,"手机已经被注册过了"));
    }
    die(returnMessage(0, "注册成功"));
    return;
}
loadTemp("system/register.temp.php");
?>